package com.hzdl.house_mgr.mapper;

import com.hzdl.house_mgr.bean.House;
import com.hzdl.house_mgr.bean.Img;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface HouseMapper {
    //房屋的分页和数量查询
    List<House> findAllByWhere(House house);
    int getCountByWhere(House house);

    //添加房屋信息
    int addHouse(House house);
    //修改房屋信息
    int updateHouse(House house);
    //删除房屋信息
    int deleteHouse(Integer houseId);

    int updateHouseStatus(@Param("houseId") Integer houseId,@Param("status") Integer status);
    //小区名模糊查询房屋信息
    List<House> findByWhere(String community);
    int getCountByWhere1(String community);

    List<House> findAll();

    int getCount();

    @Insert("insert into img_house values(null,#{hid},#{img})")
    void insertImg(@Param("hid")Integer houseId, @Param("img") String src);

    House findHouse(Integer houseId);

    House findHouseByHid(Integer houseId);

    List<Img> findImgById(@Param("hid")Integer houseId);

    //网页通过id查找房屋信息
    House findById(int houseId);

    //发布房源
    int pushHouse(House house);
}
